package org.geometerplus.android.fbreader;

import org.geometerplus.android.fbreader.FBAndroidAction;
import org.geometerplus.android.fbreader.FBReader;
import org.geometerplus.android.fbreader.bookmark.EditBookmarkActivity;
import org.geometerplus.android.fbreader.libraryService.BookCollectionShadow;
import org.geometerplus.fbreader.book.Bookmark;
import org.geometerplus.fbreader.fbreader.FBReaderApp;

/**
 * author : wangliang
 * date   : 2021/11/17 0017上午 10:57
 * desc   :划线
 */ 
class SelectionLineAction extends FBAndroidAction {
    private final BookCollectionShadow myCollection = new BookCollectionShadow();
   public SelectionLineAction(FBReader baseActivity, FBReaderApp fbreader) {
        super(baseActivity, fbreader);
    }
    @Override
    protected void run(Object... params) {
        final Bookmark bookmark;
        if (params.length != 0) {
            bookmark = (Bookmark)params[0];
        } else {
            bookmark = Reader.addSelectionBookmark();
        }
        if (bookmark == null) {
            return;
        }
        bookmark.setText("");
        myCollection.bindToService(BaseActivity, new Runnable() {
            public void run() {
                myCollection.saveBookmark(bookmark);
            }
        });

    }
}
